Skip to content

fix(nuxi): keep cwd at project root during preview#1235

Open
Davidson3556 wants to merge 3 commits intonuxt:mainfrom
Davidson3556:main
Open

fix(nuxi): keep cwd at project root during preview#1235
Davidson3556 wants to merge 3 commits intonuxt:mainfrom
Davidson3556:main

Conversation

@Davidson3556
Copy link

🔗 Linked issue

resolves nuxt/nuxt#34397

📚 Description

nuxt preview was spawning the server with cwd set to the .output directory,
which means process.cwd() inside server handlers returns .output instead of
the project root. This is inconsistent with running node .output/server/index.mjs
directly, which keeps the cwd at project root.

The fix keeps cwd as the project root when spawning the preview server, and
resolves the server entrypoint args to absolute paths using outputPath so they
work without needing a chdir.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent working directory between nuxt dev, nuxt preview, node .output/server/index.mjs and node server/index.mjs

3 participants